<?php
include_once('header.inc');
?>
<table width="980" height="100%" 
border="0" align="center" cellpadding="0" cellspacing="0"  class="gen_tb">
  
  <tr>
    <td height="15" valign="bottom" bgcolor="#cccccc"></td>
    <td colspan="2" align="center" valign="top">
    <td valign="top" class="main-name-h">Home
    <td colspan="2" align="center" valign="top">    
    <td valign="bottom" bgcolor="#cccccc"></td>
  </tr>
  <tr>
    <td height="1230" valign="bottom" bgcolor="#cccccc"></td>
    <td width="201" align="center" valign="top"><table width=180 border=0 cellpadding=0 cellspacing=0 background="images/middle.gif">
          <tbody>
            <tr>
              <td height="2" class="table-top"></td>
            </tr>
            <tr>
              <td align=left valign=top class="left">
<?php
include_once('categories1.inc');
?>
</td>
            </tr>
            <tr>
              <td height="8" class="table-bottom"></td>
            </tr>
          </tbody>
        </table>
      <br>
        <table width=180 
            border=0 align="center" cellpadding=0 cellspacing=0 
            background="images/middle.gif">
          <tbody>
            <tr>
              <td width="8" height="2" class="table-top"></td>
              <td width="172" class="table-top"></td>
            </tr>
            <tr>
              <td align=left valign=center class="left-rss">:<br>
                  <br>
                  <p></p>
                <p></p></td>
              <td align=left valign=center class="left-rss"><span class="left-b"><img src="images/rss.gif" width="36" height="14">RSS Feeds</span><br>
                  <img src="images/rss-1.gif" alt="new" width="14" height="14"><a href="rss.php">New Releases and Updates</a><br>
                  <img src="images/rss-1.gif" alt="new" width="14" height="14"><a href="rss.php?feed=popular">Most Popular Software</a><br>
                  <img src="images/rss-1.gif" alt="new" width="14" height="14"><a href="rss.php?feed=rating">Top Rated Software</a></td>
            </tr>
            <tr>
              <td height="8" colspan="2" class="table-bottom"></td>
            </tr>
          </tbody>
        </table><br>
    <td width="1" valign="top" background="images/line--3.gif">
    <td width="567" valign="top"><DIV class="main-txt" id=div_right><BR>
      <DIV class=right_n>
        <TABLE width="100%">
          <TBODY>
            <TR>
              <TD width="50%" height="213">&nbsp;</TD>
              <TD width="50%"><H1>&nbsp;</H1>                </TD>
            </TR>
          </TBODY>
        </TABLE>
        <span class="main-name">New Software </span></DIV>
<?php
$sql="SELECT * FROM paddata WHERE affiliate != '' ORDER BY pdate desc, status LIMIT 15";
$database->setQuery($sql);
$result = $database->loadAssocList();
foreach ($result as $query){
	$progid       = $query["progid"];
	$title        = htmlspecialchars($query["title"]);
	$version      = $query["version"];
	$pdate        = $query["pdate"];
	$status       = $query["status"];
	$discounturl  = $query["discounturl"];
	$description  = htmlspecialchars($query["description"]);
	$descrlarge   = nl2br(htmlspecialchars($query["descrlarge"]));
	$ksize        = number_format($query["ksize"]/1024, 2, '.', '');
	$msize 		  = number_format($query["ksize"]/1024/1024, 2, '.', '');
	if($msize>1){
		$ksize = $msize." M";
	}else {
		$ksize = $ksize." KB";
	}
	$affiliate    = htmlspecialchars($query["affiliate"]);
	$affiliateid  = $query["affiliateid"];
	$descrlarge   = $database->noBreakWord($descrlarge,$max);
	$icon         = $query["icon"];
	$cost         = sprintf("%01.2f",$query["cost"]);
	$discounturl_img = "";
	if($discounturl!="")$discounturl_img = "<a href=$discounturl><img src=images/discount-10p.gif border=0 height=12 width=23></a>";
	if($icon == "none") $iconimg = "images/noicon.gif";
	else $iconimg = $icon;
	if($status==1){
		$pic = "<img src=\"images/upd.gif\" width=\"61\" height=\"21\">";
	}else {
		$pic = "<img name=\"\" src=\"images/new.gif\" width=\"23\" height=\"12\" alt=\"\">";
	}
	$buynowlnk = "";
	if($affiliate && $affiliateid) {
		$pick = "<img name=\"\" src=\"images/pick.gif\" width=\"23\" height=\"12\" alt=\"\">";
		if($affiliate == "RegNow") {
			$affiliatelnk = "https://www.regnow.com/softsell/nph-softsell.cgi?affiliate=" . $regnowafl . "&item=" . $affiliateid;
		}
		if($affiliate == "Share-It") {
			$affiliatelnk = "https://secure.shareit.com/shareit/checkout.html?affiliateid=" . $shareitafl . "&productid=" . $affiliateid;
		}
		if($affiliate == "eSellerate") {
			$affiliatelnk = "http://store.esellerate.net/a.asp?c=0_" . $affiliateid . "_" . $esellerateafl;
		}
		if($affiliate == "Plimus") {
			$affiliatelnk = "https://www.plimus.com/jsp/buynow.jsp?contractId=" . $affiliateid . "&referrer=" . $plimusafl;
		}
		if($affiliatelnk) {
			$buynowlnk = $affiliatelnk;
		}
	}
	echo  "<img src=$iconimg width=28 height=30 align=absMiddle> 
	<span class=\"main-name\"><a href=\"index04_p_$progid.html\">$title</a></span>
	$pick.
	$pic.$discounturl_img
	<br>";
	echo $description."</br>".$descrlarge.".......</br>";
	echo "<DIV class=db><a href=download_p_$progid.html>
        [Download $ksize ]</a> <img 
                  src=\"images/1-bg.gif\" width=\"1\" height=\"1\" hspace=2> <a href=$buynowlnk>[Buy  $ $cost]</a></DIV>";
}
##############################################HELP ###########################   
     echo  "<p class=\"help\"><table>";
     $sql = "SELECT * FROM helps WHERE subclass='ALL' ORDER BY DATE DESC"; 
     $database->setQuery($sql);
     $result = $database->loadAssocList();
     $no=0;
     foreach ($result as $row){
     	$no++;
     	$help_title=$row['title'];
      echo "<tr><td><font color=red><strong>$no.　</strong></font></td><td><a href=\"index04.html\">$help_title</a></td><tr>";
         
     }
       echo "</table></p>";
 ?> 
        </div>
      <TABLE width="100%">
        <TBODY>
          <TR>
            <TD width="49%" height="158"><div class="name"><strong class="main-image">New releases &amp; updates</strong></div>
            <table>
<?php
##############################################New releases###########################################
$sql="SELECT * FROM paddata  ORDER BY pdate desc, status LIMIT 15";
$database->setQuery($sql);
$result = $database->loadAssocList();
foreach ($result as $query){  
	$progid       = $query["progid"];
	$title        = htmlspecialchars($query["title"]);
	$status       = $query["status"];
	$statustxt = "NEW";
	if($status == "1") {
		$statustxt = "UPd";
	}
echo "<tr><td><a href=\"index04_p_$progid.html\"><span class=\"nw\">$title</a></span></td><td> <font color=red size=1>$statustxt</font></td><tr>";
}        
?>
</table>
 </TD>
            <TD width="51%"><div class="name"><strong class="main-image">Most popular software</strong></div>  
               <table>
<?php
##############################################Most popular software###########################################
$sql="SELECT * FROM paddata ORDER BY dlcount desc, pdate desc LIMIT 15";
$database->setQuery($sql);
$result = $database->loadAssocList();
foreach ($result as $query){  
	$progid       = $query["progid"];
	$title        = htmlspecialchars($query["title"]);
	$status       = $query["status"];
	$statustxt = "NEW";
	if($status == "1") {
		$statustxt = "UPd";
	}
echo "<tr><td><a href=\"index04_p_$progid.html\"><span class=\"nw\">$title</a></span></td><td> <font color=red size=1>$statustxt</font></td><tr>";
}        
?>
</table>          
               </TD>
          </TR>
        </TBODY>
      </TABLE>
      </DIV>
    <td width="1" valign="top" background="images/line--3.gif">
    <td width="208" align="center" valign="top"><table class=solidb cellspacing=0 cellpadding=0 width="85%" 
            align=center border=0>
      <tbody>
        <tr>
          <td height="22" align=middle valign=top class="name"><p class="right">Spotlight</p></td>
        </tr>
<?php
##############################################Spotlight###########################################
$sql="SELECT * FROM paddata where spotlight=1 ORDER BY progid desc, pdate desc LIMIT 10";
$database->setQuery($sql);
$result = $database->loadAssocList();
foreach ($result as $query){  
	$progid       = $query["progid"];
	$title        = htmlspecialchars($query["title"]);
	$status       = $query["status"];
	$description  = htmlspecialchars($query["description"]);  
	$screenshot   = $query["screenshot"];
	if($screenshot=="none")   
    $screenshot   = WEBSITE."/images/screenshot.gif";
     echo "<tr>
          <td 
                background=\"images/line-3.gif\" class=\"name\"><img 
                  height=1 
                  src=\"images/1-bg.gif\" 
                  width=1 border=0></td>
        </tr>
        <tr>
          <td valign=top class=\"name\"><img height=17 hspace=3 
                  src=\"images/arrow-b.gif\" 
                  width=4 align=absMiddle border=0><b class=\"right-name\"><a href=\"index04_p_$progid.html\" target=_blank> $title</a></b></td>
        </tr>
        <tr>
          <td width=\"40%\" height=\"183\" align=middle valign=top class=\"g-ding\"><img src=\"$screenshot\"width=\"100\" height=\"100\" 
                  vspace=10 border=0><br>
            $description<br>
            <br></td>
        </tr>";
}
 ?>       
    <tr>
          <td 
                background="images/line-3.gif" class="name"><img 
                  height=1 
                  src="images/1-bg.gif" 
                  width=1 border=0></td>
     </tr>
  
      </tbody>
    </table>
      <br>
    <td valign="bottom" bgcolor="#cccccc"></td>
  </tr>
  <tr>
    <td height="2" valign="bottom" bgcolor="#cccccc"></td>
    <td colspan="5" align="center" valign="top" background="images/line-3.gif">
    <td valign="bottom" bgcolor="#cccccc"></td>
  </tr>
  <tr>
    <td width="1" height="31" valign="bottom" bgcolor="#cccccc"></td>
    <td colspan="5" align="center" valign="top"><table width="905" height="30" border=0 align="center" cellpadding=0 cellspacing=0 class=letters>
      <tbody>
        <tr>
          <?php 
                  $a="A";
                  for($i=0;$i<26;$i++){
                  	 echo  "<td width=\"23\" height=\"30\" class=\"letters\"><a href=\"asearch_keyauthor_words$a.html\">$a</a></td>";
                     $a++;
                  }
                   ?>
                   

                    <td width="23" height="30" class="letters"><a href="asearch_keyauthor_words1.html">1</a></td>
                    <td width="23" height="30" class="letters"><a href="asearch_keyauthor_words2.html">2</a></td>
                    <td width="23" height="30" class="letters"><a href="asearch_keyauthor_words3.html">3</a></td>
                    <td width="23" height="30" class="letters"><a href="asearch_keyauthor_words4.html">4</a></td>
                    <td width="23" height="30" class="letters"><a href="asearch_keyauthor_words5.html">5</a></td>
                    <td width="23" height="30" class="letters"><a href="asearch_keyauthor_words6.html">6</a></td>
                    <td width="23" height="30" class="letters"><a href="asearch_keyauthor_words7.html">7</a></td>
                    <td width="23" height="30" class="letters"><a href="asearch_keyauthor_words8.html">8</a></td>
                    <td width="23" height="30" class="letters"><a href="asearch_keyauthor_words9.html">9</a></td>
                    <td width="23" height="30" class="letters"><a href="asearch_keyauthor_words10.html">0</a></td>
                    <td width="23" height="30" class="letters"><a href="asearch_keyauthor_words#.html">#</a></td>
                    <td width="23" height="30" class="letters"><a href="asearch_keyauthor_words!.html">!</a></td>
                    <td width="29" height="30" class="letters"><a href="asearch_keyauthor_words@.html">@</a></td>
        </tr>
      </tbody>
    </table>
    <td width="1" valign="bottom" bgcolor="#cccccc"></td>
  </tr>
</table>
<?php
include_once('fooder.inc');
?>